// 云函数入口文件
const cloud = require('wx-server-sdk')

cloud.init()

// 云函数入口函数
let db = cloud.database();
exports.main = async(event, context) => {
  let openid = event.userInfo.openId;
  let item_id = event.item_id;
  console.log('openid', openid);
  console.log('item_id', item_id);
  try {
    return await db.collection('tb_collect_list').where({
      _openid: openid,
      item_id: item_id
    }).get()
  } catch (e) {
    console.error(e)
  }
}